package com.pets.web.controller.admin;


import com.pets.common.core.controller.BaseController;
import com.pets.common.core.domain.AjaxResult;
import com.pets.common.core.page.TableDataInfo;
import com.pets.web.entity.PetExpress;
import com.pets.web.entity.PetsShop;
import com.pets.web.service.IPetExpressService;
import com.pets.web.service.IPetsShopService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 物流信息表 前端控制器
 * </p>
 *
 * @author zhurenwang
 * @since 2024-05-29
 */
@RestController
@RequestMapping("/express")
public class PetExpressController extends BaseController {

    @Autowired
    private IPetExpressService petExpressService;

    @GetMapping("/list")
    public TableDataInfo<PetExpress> list(PetExpress petExpress){
        startPage();
        List<PetExpress> list = petExpressService.list(petExpress);
        return getDataTable(list);
    }

    @PostMapping()
    public AjaxResult add(@RequestBody PetExpress petExpress){
        return success(petExpressService.add(petExpress));
    }

    @DeleteMapping("/{id}")
    public AjaxResult delete(@PathVariable Integer id){
        return success(petExpressService.deleteById(id));
    }

    @GetMapping("/{id}")
    public AjaxResult get(@PathVariable Integer id){
        return success(petExpressService.getById(id));
    }

    @PutMapping()
    public AjaxResult edit(@RequestBody PetExpress petExpress){
        return success(petExpressService.updateById(petExpress));
    }


}
